import axios from '@/libs/api.request'
import { TOKEN_KEY } from '@/libs/util'
import Cookies from 'js-cookie'
let method = 'post'
let token = Cookies.get(TOKEN_KEY)

export default (url, data) => {
  if (token) token = Cookies.get(TOKEN_KEY)
  return axios.request({
    // url: `v1/api/${url}`,
    url: url,
    data: { token, ...data },
    method
  })
}
